@extends('layouts.default')
@section('content')
    <div class="card">
        <div class="card-header">
            <div class="text-center">
                <h3><b>{{$user -> name }}</b></h3>
                <a href="{{route('user.follow',$user)}}"
                   class="btn btn-info">{{$follow}} </a>
                <a href="{{route('followed',$user)}}" class="btn btn-success">粉丝 {{$user->following()->count()}}</a>
                <a href="{{route('following',$user)}}" class="btn btn-success">关注 {{$user->followed()->count()}}</a>
            </div>
        </div>
        <div class="card-body">
            <table class="table">
                <thead>
                <tr>
                    <th>博文</th>
                    <th width="200">时间</th>
                    <th width="100">操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach($blogs as $blog)
                    <tr>
                        <td scope="row">{{$blog -> content}}</td>
                        <td>{{$blog ->created_at}}</td>
                        <td>
                            @auth
                                @can('delete',$blog)
                                    <form action="{{route('blog.destroy',$blog)}}" method="post">
                                        @method('DELETE')
                                        @csrf
                                        <button type="submit" class="btn btn-danger">删除</button>
                                    </form>
                                @endcan
                            @endauth
                        </td>
                    </tr>
                @endforeach
                </tbody>
            </table>
        </div>
        <div class="card-footer text-muted">

        </div>
    </div>
@endsection
